package com.sat.client.adapter

import android.content.Context
import android.graphics.Color
import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.content.res.AppCompatResources
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.sat.client.R
import com.sat.client.bean.DeviceInfo

class DirectoryAdapter : BaseQuickAdapter<String, QuickViewHolder>() {
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: String?) {
        item?.run {
            val textView = holder.getView<TextView>(R.id.tv_title)
            if (position == items.size - 1) {

                textView.setTextColor(Color.parseColor("#232323"))
            }else{
                textView.setTextColor(Color.parseColor("#FF9800"))
            }
            holder.setText(R.id.tv_title, this)
            holder.setVisible(R.id.imv_icon, position != items.size - 1)
        }

    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(R.layout.layout_directory_item, parent)
    }
}